using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIManager : MonoBehaviour
{
    public static UIManager instance;
    public InputField levelTitleInputField;
    public InputField levelDescriptionInputField;
    public Text levelTitle;
    public Text levelDescription;
    public Text stepNum;

    public Text boxSpeedText;
    public Slider boxSpeedSlider;

    public Toggle arrowToggle;

    public Text changeSpeedText;
    private void Awake()
    {
        instance = this;
    }

    private void Start()
    {
        //arrowToggle.isOn = GameManager.instance.openArrow;
    }
    private void Update()
    {
        stepNum.text = "step:" + LevelManager.instance.nowSteps.ToString();

        if (Input.GetKeyDown(KeyCode.Space))
        {
            ChangeSpeed();
        }
    }

    public void ChangeArrowToggle()
    {
        //GameManager.instance.openArrow = arrowToggle.isOn;
    }
    /*
    public void ChangeBoxSpeed()
    {
        boxSpeedText.text = "speed:" + boxSpeedSlider.value.ToString();
        LevelManager.instance.SetBoxSpeed(boxSpeedSlider.value);
    }*/
    public void LevelButton(GameObject gb)
    {
        GameManager.instance.ButtonClick();
        if (gb.name == "Esc")
        {
            GameManager.instance.ReturnMainMenu();
        }
        else if (gb.name == "Z")
        {
            LevelManager.instance.Z();
        }
        else if (gb.name == "X")
        {
            LevelManager.instance.X();
        }
        else if (gb.name == "R")
        {
            LevelManager.instance.R();
        }
    }

    public void ChangeSpeed()
    {
        Time.timeScale = 1.3f - Time.timeScale;
        changeSpeedText.text = Time.timeScale.ToString() + "x";
        GameManager.instance.ButtonClick();
    }

}
